<?php
/**
 * Created by PhpStorm.
 * User: Shine
 * Date: 2019-02-23
 * Time: 15:17
 */

namespace app\m\controller;

use think\Db;

class Duty
{

    public function home()
    {
        $b = 1;

        $ses = session('ses');
        if (!$ses) {
            echo '{"err":1,"msg":"auth error"}';
            return;
        }
        $uid = $ses['uid'];

        $redis = redis();
        $role = $redis->get("r{$uid}"); // uid角色

        // 查询角色  最后选择角色与学校
        // $rs = $uid ? Db::query('select type,pid from x1_user_role where uid=? and state=1 and b=?', [$uid, $b]) : null; // 没有角色

        $rev = ['err' => 0, 'msg' => ''];
        if (!$role) {
            $rev['b'] = 1;
            $rev['c'] = ['note' => '您还未认证，点击认证'];
        } else {

            // 已经有角色  单个和多个角色

            $rev['b'] = 2;




        }

        //

        // 列出  考核项目


        echo json_encode($rev);
    }

    // 学校考核
    protected function school_ass()
    {


    }

    public function test()
    {
        $redis = redis();

        $rev = $redis->get('P1');

        var_dump($rev);

    }


}
